package controll;

import java.sql.Connection;
import java.sql.DriverManager;

public class ConnectData {
	public static Connection con = null;

	/**
	 * @return true - connect data success
	 * 		   false - connect data fail
	 */
	public static boolean getConnection() {
		try {
			Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
			String ulr = "jdbc:sqlserver://localhost:1433;database=QLBanVeTau;username=sa;password=12345;";
			if (con == null) {
				con = DriverManager.getConnection(ulr);
			}
			return true;
		} catch (Exception ex) {
			ex.printStackTrace();
			return false;
		}
	}
	
	public static void main(String[] args) {
		getConnection();
	}
}